package com.content.management.dao;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.content.management.domain.dto.SummaryByClassificationDto;
import com.content.management.domain.entity.BusPublishContent;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 发布内容 Mapper 接口
 * </p>
 *
 * @author xinghu
 * @since 2020-04-04
 */
public interface BusPublishContentDao extends BaseMapper<BusPublishContent> {

	/**
	 * 通过所属分类获取分类管理信息
	 *
	 * @param wrapper 查询条件
	 * @return 查询结果
	 */
	@Select("SELECT classification,COUNT(*) AS countNum FROM bus_publish_content ${ew.customSqlSegment} GROUP BY classification")
	List<SummaryByClassificationDto> summaryByClassification(@Param(Constants.WRAPPER) Wrapper<BusPublishContent> wrapper);

}
